home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Text / WASTE / WASTE 1.2a2 / WASTEIntf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-12  |  54.9 KB  |  1,285 lines  |  [TEXT/CWIE]

  1. /*
  2.  *    WASTEIntf.h
  3.  *
  4.  *    WASTE PROJECT
  5.  *  Internal (private) interface
  6.  *
  7.  *  Copyright (c) 1993-1995 Marco Piovanelli
  8.  *    All Rights Reserved
  9.  *
  10.  *  C port by Dan Crevier
  11.  *
  12.  */
  13.  
  14.  
  15. #ifndef __CONDITIONALMACROS__
  16. #include <ConditionalMacros.h>
  17. #endif
  18.  
  19. #ifndef __TYPES__
  20. #include <Types.h>
  21. #endif
  22.  
  23. #ifndef __MIXEDMODE__
  24. #include <MixedMode.h>
  25. #endif
  26.  
  27. #ifndef __LONGCOORDINATES__
  28. #ifndef _LongCoords_
  29. #include "LongCoords.h"
  30. #endif
  31. #endif
  32.  
  33. #ifndef __QUICKDRAWTEXT__
  34. #include <QuickdrawText.h>
  35. #endif
  36.  
  37. #ifndef __QUICKDRAW__
  38. #include <Quickdraw.h>
  39. #endif
  40.  
  41. #ifndef __TEXTEDIT__
  42. #include <TextEdit.h>
  43. #endif
  44.  
  45. #ifndef __SCRAP__
  46. #include <Scrap.h>
  47. #endif
  48.  
  49. #ifndef __TEXTSERVICES__
  50. #include <TextServices.h>
  51. #endif
  52.  
  53. #ifndef __SCRIPT__
  54. #include <Script.h>
  55. #endif
  56.  
  57. #ifndef __TOOLUTILS__
  58. #include <ToolUtils.h>
  59. #endif
  60.  
  61. #ifndef __TEXTUTILS__
  62. #include <TextUtils.h>
  63. #endif
  64.  
  65. #ifndef __LOWMEM__
  66. #include <LowMem.h>
  67. #endif
  68.  
  69. #ifndef __APPLEEVENTS__
  70. #include <AppleEvents.h>
  71. #endif
  72.  
  73. #ifndef __AEREGISTRY__
  74. #include <AERegistry.h>
  75. #endif
  76.  
  77. #ifndef __DRAG__
  78. #include <Drag.h>
  79. #endif
  80.  
  81. #ifndef _LIMITS
  82. #include <limits.h>
  83. #endif
  84.  
  85. // MPW needs topLeft and botRight defined here
  86. #ifndef topLeft
  87. #define topLeft(r)              (((Point *) &(r))[0])
  88. #endif
  89.  
  90. #ifndef botRight
  91. #define botRight(r)             (((Point *) &(r))[1])
  92. #endif
  93.  
  94. // pascal-like macros for testing, setting, clearing and inverting bits
  95. #define BTST( FLAGS, BIT )    ((FLAGS) &   (1L << (BIT)))
  96. #define BSET( FLAGS, BIT )  ((FLAGS) |=  (1L << (BIT)))
  97. #define BCLR( FLAGS, BIT )  ((FLAGS) &= ~(1L << (BIT)))
  98. #define BCHG( FLAGS, BIT )  ((FLAGS) ^=  (1L << (BIT)))
  99.  
  100. // pascal-like macros for shifting bits
  101. #define BSL( A, B )            (((long) (A)) << (B))
  102. #define BSR( A, B )            (((long) (A)) >> (B))
  103.  
  104. // macros used in conjunction with the styleRunPosition parameter
  105. #define IS_FIRST_RUN(RUN)    ((RUN) <= leftStyleRun)
  106. #define IS_LAST_RUN(RUN)    (! ((RUN) & 0x01))
  107.  
  108. // other macros
  109. #define ABS(A)                 ((A) > 0 ? (A) : -(A))
  110. #define BLOCK_CLR(X)        _WEBlockClr(&(X), sizeof(X));
  111.  
  112. // set WASTE_DEBUG to 1 to perform various consistency checks;
  113. // errors will be reported with DebugStr()
  114. // WARNING: when WASTE_DEBUG is set, WEIdle() calls can be extremely time-consuming
  115. #ifndef WASTE_DEBUG
  116. #define WASTE_DEBUG                0
  117. #endif
  118.  
  119. // set WASTE_OBJECTS to 0 if you don't need embedded objects
  120. #ifndef WASTE_OBJECTS
  121. #define    WASTE_OBJECTS            1
  122. #endif
  123.  
  124. // set WASTE_USE_UPPS to 0 if you don't need UPPs
  125. #ifndef WASTE_USE_UPPS
  126. #define WASTE_USE_UPPS            GENERATINGCFM
  127. #endif
  128.  
  129. // set WASTE_REDRAW_SPEED to 1 to use Mark Alldritt's optimizations of _WERedraw
  130. #ifndef WASTE_REDRAW_SPEED
  131. #define WASTE_REDRAW_SPEED        0
  132. #endif
  133.  
  134. // set WASTE_PIN_SCROLL to 1 to use Chris Thomas's version of WEScroll(),
  135. // which behaves like TEPinScroll()
  136. #ifndef WASTE_PIN_SCROLL
  137. #define WASTE_PIN_SCROLL        0
  138. #endif
  139.  
  140. // set WASTE_NO_SYNCH to 1 if you don't want WASTE to synchronize keyboard and fonts
  141. #ifndef WASTE_NO_SYNCH
  142. #define WASTE_NO_SYNCH            0
  143. #endif
  144.  
  145. // set WASTE_NO_RO_CARET to 1 to hide the caret in read-only mode
  146. #ifndef WASTE_NO_RO_CARET
  147. #define WASTE_NO_RO_CARET        0
  148. #endif
  149.  
  150. // set WASTE_IC_SUPPORT to 1 to use Dan Crevier's
  151. // support of URL cmd-clicking through Internet Config
  152. #ifndef WASTE_IC_SUPPORT
  153. #define WASTE_IC_SUPPORT        0
  154. #endif
  155.  
  156. // If WASTE_OBJECTS_ARE_GLYPHS is set to 0 (default), WEGetOffset returns kObjectEdge in
  157. // the edge parameter when thePoint is in the middle half of an object: as a result,
  158. // clicking in the middle of an object immediately _selects_ the object, so that a second
  159. // click immediately following triggers the 'clik' callback (this can be handy to make
  160. // sound objects play when they are double-clicked, for example).
  161.  
  162. // If WASTE_OBJECTS_ARE_GLYPHS is set to 1, WEGetOffset treats embedded objects
  163. // like ordinary glyphs and never returns kObjectEdge in the edge parameter:
  164. // as a result, clicking in the middle of an object always positions the caret either
  165. // to the left or to the right of the object.
  166.  
  167. #ifndef WASTE_OBJECTS_ARE_GLYPHS
  168. #define WASTE_OBJECTS_ARE_GLYPHS    0
  169. #endif
  170.  
  171. // set WASTE_RESOLVE_FONT_DESIGNATORS to FALSE if you don't want WASTE to
  172. // map font designators (the special IDs 0 and 1 that identify the system
  173. // and application fonts, respectively) to the actual font IDs.
  174.  
  175. #ifndef WASTE_RESOLVE_FONT_DESIGNATORS
  176. #define WASTE_RESOLVE_FONT_DESIGNATORS    1
  177. #endif
  178.  
  179. // set WASTE_WECALTEXT_DOES_REDRAW to TRUE if you want WECalText()
  180. // to automatically redraw all the text (as in WASTE 1.1 final)
  181.  
  182. #ifndef WASTE_WECALTEXT_DOES_REDRAW
  183. #define WASTE_WECALTEXT_DOES_REDRAW        0
  184. #endif
  185.  
  186. // macros for debugging
  187.  
  188. #if WASTE_DEBUG
  189. #define WEASSERT(CONDITION, WARNING)    { if (!(CONDITION)) DebugStr(WARNING); }
  190. #else
  191. #define WEASSERT(CONDITION, WARNING)
  192. #endif
  193.  
  194. #ifndef UNIVERSAL_INTERFACES_VERSION
  195. typedef unsigned short EventModifiers;    // defined in the Universal Headers v2.1 or later
  196. #endif
  197.  
  198. // result codes
  199. enum {
  200.     weCantUndoErr                =    -10015,    // undo buffer is clear (= errAECantUndo) 
  201.     weEmptySelectionErr            =    -10013,    // selection range is empty (= errAENoUserSelection) 
  202.     weUnknownObjectTypeErr        =    -9478,    // specified object type is not registered 
  203.     weObjectNotFoundErr            =    -9477,    // no object found at specified offset 
  204.     weReadOnlyErr                =    -9476,    // instance is read-only
  205.     weNotHandledErr                =    -1708,  // please use default handling (= errAEEventNotHandled)
  206.     weUndefinedSelectorErr        =    -50,    // unknown selector 
  207.     weNoDragErr                 =     128        // can be returned internally by _WEDrag
  208. };
  209.  
  210. // values for WEInstallObjectHandler handlerSelector parameter
  211. enum {
  212.     weNewHandler         =     'new ',
  213.     weDisposeHandler     =     'free',
  214.     weDrawHandler         =     'draw',
  215.     weClickHandler         =     'clik',
  216.     weStreamHandler        =    'strm'
  217. };
  218.  
  219. //    action kinds 
  220. enum {
  221.     weAKNone            =    0,        // null action 
  222.     weAKUnspecified        =    1,        // action of unspecified nature 
  223.     weAKTyping            =    2,        // some text has been typed in 
  224.     weAKCut                =    3,        // the selection range has been cut 
  225.     weAKPaste            =    4,        // something has been pasted 
  226.     weAKClear            =    5,        // the selection range has been deleted 
  227.     weAKDrag            =    6,        // drag and drop operation 
  228.     weAKSetStyle        =    7        // some style has been applied to a text range 
  229. };
  230.  
  231. // action flags 
  232. enum {
  233.     weAFIsRedo            =    0x0001,    // action saves edit state prior to a WEUndo call
  234.     weAFDontSaveText    =    0x0002, // don't save text
  235.     weAFDontSaveStyles    =    0x0004,    // don't save styles
  236.     weAFDontSaveSoup    =    0x0008    // don't save soup
  237. };
  238.  
  239. typedef short WEActionKind;
  240. typedef short WEActionFlags;
  241.  
  242. //    destination kinds for streaming objects
  243.  
  244. enum {
  245.     weToScrap            =    0,
  246.     weToDrag            =    1,
  247.     weToSoup            =    2
  248. };
  249.  
  250. //    alignment styles 
  251. enum {
  252.     weFlushLeft         =    -2,        // flush left 
  253.     weFlushRight        =    -1,        // flush right 
  254.     weFlushDefault        =     0,        // flush according to system direction 
  255.     weCenter            =     1,        // centered 
  256.     weJustify            =     2        // fully justified 
  257. };
  258.  
  259. // values for the edge parameter
  260. enum {
  261.     kLeadingEdge = -1,            // point is on the leading edge of a glyph
  262.     kTrailingEdge = 0,            // point is on the trailing edge of a glyph
  263.     kObjectEdge = 2                // point is inside an embedded object
  264. };
  265.  
  266. // control character codes
  267. enum {
  268.     kObjectMarker = 1,
  269.     kBackspace = 8,
  270.     kTab = 9,
  271.     kEOL = 13,
  272.     kSpace = 32,
  273.     kArrowLeft = 28,
  274.     kArrowRight = 29,
  275.     kArrowUp = 30,
  276.     kArrowDown = 31,
  277.     kForwardDelete =127
  278. };
  279.  
  280. // bit equates for QuickDraw styles
  281. enum {
  282.     tsBold = 0,
  283.     tsItalic = 1,
  284.     tsUnderline = 2,
  285.     tsOutline = 3,
  286.     tsShadow = 4,
  287.     tsCondense = 5,
  288.     tsExtend = 6
  289. };
  290.  
  291. // bit equates for the tsFlags field of the WETextStyle record
  292. enum {
  293.     tsTSMHilite = 4,                        // set if style run is part of active input area
  294.     tsTSMSelected = 5,                        // set for selected raw/converted text
  295.     tsTSMConverted = 6,                        // set for converted text, clear for raw text
  296.     tsRightToLeft = 7                        // set for right-to-left runs
  297. };
  298.  
  299. // bit equates for the mode parameter in WESetStyle and WEContinuousStyle
  300. enum {
  301.     kModeFont = 0,                        // change font
  302.     kModeFace = 1,                        // change Quickdraw styles
  303.     kModeSize = 2,                        // change point size
  304.     kModeColor = 3,                        // change color
  305.     kModeAddSize = 4,                    // add tsSize to existing size
  306.     kModeToggleFace = 5,                // toggle continuous styles rather than setting them
  307.     kModeReplaceFace = 6,                // tsFace replaces existing styles outright
  308.     kModePreserveScript = 7,            // apply font to runs of same script only
  309.     kModeExtractSubscript = 8,            // apply font to eligible subruns of different script
  310.     kModeFaceMask = 9,                    // change Quickdraw styles; use mask
  311.     kModeObject = 14,
  312.     kModeFlags = 15
  313. };
  314.  
  315. // values for the mode parameter in WESetStyle and WEContinuousStyle
  316. enum {
  317.     weDoFont                =    1 << kModeFont,
  318.     weDoFace                =    1 << kModeFace,
  319.     weDoSize                =    1 << kModeSize,
  320.     weDoColor                =    1 << kModeColor,
  321.     weDoAll                    =    weDoFont + weDoFace + weDoSize + weDoColor,
  322.     weDoAddSize                =    1 << kModeAddSize,
  323.     weDoToggleFace            =    1 << kModeToggleFace,
  324.     weDoReplaceFace            =    1 << kModeReplaceFace,
  325.     weDoPreserveScript        =    1 << kModePreserveScript,
  326.     weDoSmartFont            =    weDoFont + weDoPreserveScript,
  327.     weDoExtractSubscript    =    1 << kModeExtractSubscript,
  328.     weDoFaceMask            =    1 << kModeFaceMask,
  329.     weDoObject                =    1 << kModeObject,
  330.     weDoFlags                =    1 << kModeFlags
  331. };
  332.  
  333. // values for WEFeatureFlag action parameter
  334. enum {
  335.     weBitClear = 0,            // disables the specified feature
  336.     weBitSet = 1,            // enables the specified feature
  337.     weBitTest = -1,            // just returns the current setting of the specified feature
  338.     weBitToggle = -2        // toggles the specified feature
  339. };
  340.  
  341. // bit equates for the flags field in the WE record
  342. enum {
  343.     weFHasColorQD = 31,                // Color QuickDraw is available
  344.     weFHasDragManager = 30,            // the Drag Manager is available
  345.     weFHasTextServices = 29,        // the Text Services Manager is available
  346.     weFNonRoman = 28,                // at least one non-Roman script is enabled
  347.     weFDoubleByte = 27,                // a double-byte script is enabled
  348.     weFBidirectional = 26,            // a bidirectional script is enabled
  349.     weFUseDualCaret = 25,            // use dual caret at direction boundaries
  350.     weFCaretVisible = 24,            // the caret is currently visible
  351.     weFMouseTracking = 23,            // set internally during mouse tracking
  352.     weFAnchorIsEnd = 22,            // anchor offset is selEnd
  353.     weFUseNullStyle = 21,            // a null style is associated with the empty selection
  354.     weFActive = 20,                    // we're active
  355.     weFHilited = 19,                // TRUE if text pane is highlighted (for Drag & Drop)
  356.     weFCanAcceptDrag = 18,            // The drag in the text pane can be accepted
  357.     weFDragCaretVisible = 17,        // Drag caret is currently visible
  358.     weFDestRectChanged = 16            // Set if scroll callback needs to be called
  359. };
  360.  
  361. // bit equates for the features field in the WE record
  362. enum {
  363.     weFDrawOffscreen = 11,            // draw text offscreen for smoother visual results
  364.     weFUseTempMem = 10,                // use temporary memory for main data structures
  365.     weFInhibitRecal = 9,            // if set, recals and redraws are inhibited
  366.     weFDragAndDrop = 8,                // Support Drag and Drop
  367.     weFIntCutAndPaste = 7,            // Intelligent Cut & Paste
  368.     weFUndoSupport = 6,                // Support Undo/Redo
  369.     weFReadOnly = 5,                // Disallow editing
  370.     weFOutlineHilite = 2,            // frame selection range when text pane is inactive
  371.     weFAutoScroll = 0                // automatically scroll text when cursor is outside pane
  372. };
  373.  
  374. // scrap types
  375. enum {
  376.     kTypeText = 'TEXT',
  377.     kTypeStyles = 'styl',
  378.     kTypeSoup = 'SOUP'
  379. };
  380.  
  381. // selectors for WEGetInfo/WESetInfo
  382. enum {
  383.     weCharByteHook = 'cbyt',
  384.     weCharTypeHook = 'ctyp',
  385.     weCharToPixelHook = 'c2p ',
  386.     weClickLoop = 'clik',
  387.     weCurrentDrag = 'drag',
  388.     weDrawTextHook = 'draw',
  389.     weLineArray = 'line',
  390.     weLineBreakHook = 'lbrk',
  391.     wePixelToCharHook = 'p2c ',
  392.     wePort = 'port',
  393.     weRefCon = 'refc',
  394.     weRunArray = 'runa',
  395.     weScrollProc = 'scrl',
  396.     weStyleTable = 'styl',
  397.     weText = 'text',
  398.     weTranslateDragHook = 'xdrg',
  399.     weTSMDocumentID = 'tsmd',
  400.     weTSMPostUpdate = 'post',
  401.     weTSMPreUpdate = 'pre ',
  402.     weWordBreakHook = 'wbrk'
  403. };
  404.  
  405. // possible values returned by WEIntelligentPaste
  406. enum {
  407.     weDontAddSpaces = 0,
  408.     weAddSpaceOnLeftSide = -1,
  409.     weAddSpaceOnRightSide = 1
  410. };
  411.  
  412. // values for WEAllocate allocFlags parameter
  413. enum {
  414.     kAllocClear = 0x0001,        // clear handle after allocation
  415.     kAllocTemp = 0x0002            // use temporary memory if available
  416. };
  417.  
  418. // other miscellaneous constants
  419. enum {
  420.     kCaretWidth = 1,            // width of the caret, in pixels
  421.     kMinFontSize = 1,            // minimum valid font size
  422.     kMaxFontSize = SHRT_MAX,    // maximum valid font size
  423.     kInvalidOffset = -1,         // used to flag an invalid or nonexistent offset
  424.     kUnknownObjectType = -1,    // returned by _WELookupObjectType for unknown flavors
  425.     kNullDrag = 0,                // null or nonexistent drag reference
  426.     kTextMargin = 3,            // width of border area surrounding the text (in pixels)
  427.     kAutoScrollDelay = 10,        // delay before auto-scroll starts (in ticks)
  428.     kDefaultObjectHeight = 32,    // default height for new objects
  429.     kDefaultObjectWidth = 32    // default width for new objects
  430. };
  431.  
  432. static const Point kOneToOneScaling = { 1, 1 };    // 1:1 scaling ratio
  433.  
  434. #if defined(powerc) || defined (__powerc)
  435. #pragma options align=mac68k
  436. #endif
  437.  
  438. // forward declarations
  439.  
  440. typedef struct WERec *WEPtr, **WEHandle;
  441. typedef struct WEObjectDesc *WEObjectDescPtr, **WEObjectDescHandle;
  442.  
  443. typedef struct WETextStyle {
  444.     short tsFont;                    // font family number 
  445.     char tsFace;                    // set of QuickDraw styles 
  446.     char tsFlags;                    // flags (FOR INTERNAL USE ONLY) 
  447.     short tsSize;                    // font size, in integer points 
  448.     RGBColor tsColor;                // absolute red-green-blue color
  449. #if WASTE_OBJECTS
  450.     WEObjectDescHandle tsObject;    // embedded object reference
  451. #endif
  452. } WETextStyle, *WETextStylePtr, **WETextStyleHandle;
  453.  
  454. typedef struct WERunAttributes {
  455.     short runHeight;            // style run height (ascent + descent + leading) 
  456.     short runAscent;            // font ascent 
  457.     WETextStyle runStyle;        // text style 
  458. } WERunAttributes, *WERunAttributesPtr, **WERunAttributesHandle;
  459.  
  460. typedef struct WERunInfo {
  461.     long runStart;                // byte offset to first character of this style run 
  462.     long runEnd;                // byte offset to first character of next style run 
  463.     WERunAttributes runAttrs;    // run attributes 
  464. } WERunInfo, *WERunInfoPtr, **WERunInfoHandle;
  465.  
  466. typedef struct QDEnvironment {
  467.     GrafPtr envPort;
  468.     PenState envPen;
  469.     WETextStyle envStyle;
  470.     short envMode;
  471. } QDEnvironment;
  472.  
  473. typedef struct RunArrayElement {
  474.     long runStart;                // offset to first character in style run
  475.     long styleIndex;            // index into style table (high word currently unused)
  476. } RunArrayElement, *RunArrayElementPtr, **RunArrayElementHandle;
  477.  
  478. typedef RunArrayElementPtr RunArrayPtr;
  479. typedef RunArrayElementHandle RunArrayHandle;
  480.  
  481. typedef struct TERunAttributes {
  482.     short runHeight;
  483.     short runAscent;
  484.     TextStyle runTEStyle;
  485. } TERunAttributes, *TERunAttributesPtr;
  486.  
  487. typedef struct TEStyleScrapElement {
  488.     long scrpStartChar;
  489.     TERunAttributes scrpTEAttrs;
  490. } TEStyleScrapElement, *TEStyleScrapElementPtr;
  491.  
  492. typedef struct TEStyleScrap {
  493.     short scrpNStyles;
  494.     TEStyleScrapElement scrpStyleTab[1];
  495. } TEStyleScrap, *TEStyleScrapPtr, **TEStyleScrapHandle;
  496.  
  497. typedef struct StyleTableElement {
  498.     long refCount;                // reference count
  499.     WERunAttributes info;        // style information
  500. } StyleTableElement, *StyleTableElementPtr, **StyleTableElementHandle;
  501.  
  502. typedef StyleTableElementPtr StyleTablePtr;
  503. typedef StyleTableElementHandle StyleTableHandle;
  504.  
  505. typedef struct LineRec {
  506.     long lineStart;                // byte offset to first character in line 
  507.     long lineOrigin;            // pixel offset from destRect.top 
  508.     short lineAscent;            // maximum font ascent for this line 
  509.     short lineSlop;                // extra pixels needed to fill up the line 
  510.     Fixed lineJustAmount;        // normalized slop value, used for justification 
  511. } LineRec, *LinePtr, **LineHandle;
  512.  
  513. typedef LinePtr LineArrayPtr;
  514. typedef LineHandle LineArrayHandle;
  515.  
  516. typedef struct WEAction {
  517.     WEHandle hOwner;            // handle to associated WE instance
  518.     struct WEAction **hNext;    // used to keep a linked list of actions
  519.     Handle hText;                // handle to saved text
  520.     Handle hStyles;                // handle to saved styles
  521.     Handle hSoup;                // handle to saved "soup"
  522.     long delRangeStart;            // start of range to delete
  523.     long delRangeLength;        // length of range to delete
  524.     long insRangeLength;        // lenfth of range to insert
  525.     long hiliteStart;            // start of range to hilite
  526.     long hiliteEnd;                // end of range to hilite
  527.     WEActionKind actionKind;    // identifies event that caused this action to be pushed
  528.     WEActionFlags actionFlags;    // miscellaneous flags
  529. } WEAction, *WEActionPtr, **WEActionHandle;
  530.  
  531. // A WESoup record is a static description of an object embedded in the text.
  532. // The 'SOUP' data type is just a collection of WESoup records, each followed
  533. // by the corresponding object data.
  534. // This data type complements the standard TEXT/styl pair.
  535.  
  536. typedef struct WESoup {
  537.     long soupOffset;            // insertion offset for this object
  538.     FlavorType soupType;        // 4-letter tag identifying object type
  539.     long soupReserved1;            // reserved for future use; set to zero
  540.     Size soupDataSize;            // size of object data following this record
  541.     Point soupSize;                // object height and width, in pixels
  542.     long soupReserved2;            // reserved for future use; set to zero
  543. } WESoup, *WESoupPtr, **WESoupHandle;
  544.  
  545. //    callback prototypes 
  546.  
  547. typedef pascal Boolean (*WEClickLoopProcPtr)(WEHandle hWE);
  548. typedef pascal void (*WEScrollProcPtr)(WEHandle hWE);
  549. typedef pascal void (*WETSMPreUpdateProcPtr)(WEHandle hWE);
  550. typedef pascal void (*WETSMPostUpdateProcPtr)(WEHandle hWE,
  551.         long fixLength, long inputAreaStart, long inputAreaEnd,
  552.         long pinRangeStart, long pinRangeEnd);
  553. typedef pascal OSErr (*WETranslateDragProcPtr)(DragReference theDrag,
  554.         ItemReference theItem, FlavorType requestedType, Handle putDataHere);
  555. typedef pascal void (*WEDrawTextProcPtr)(Ptr pText, long textLength, Fixed slop,
  556.         JustStyleCode styleRunPosition, WEHandle hWE);
  557. typedef pascal long (*WEPixelToCharProcPtr)(Ptr pText, long textLength, Fixed slop,
  558.         Fixed *pixelWidth, char *edge, JustStyleCode styleRunPosition, Fixed hPos, WEHandle hWE);
  559. typedef pascal short (*WECharToPixelProcPtr)(Ptr pText, long textLength, Fixed slop,
  560.         long offset, short direction, JustStyleCode styleRunPosition, long hPos, WEHandle hWE);
  561. typedef pascal StyledLineBreakCode (*WELineBreakProcPtr)(Ptr pText, long textLength,
  562.         long textStart, long textEnd, Fixed *textWidth, long *textOffset, WEHandle hWE);
  563. typedef pascal void (*WEWordBreakProcPtr)(Ptr pText, short textLength, short offset,
  564.         char edge, OffsetTable breakOffsets, ScriptCode script, WEHandle hWE);
  565. typedef pascal short (*WECharByteProcPtr)(Ptr pText, short textOffset, ScriptCode script,
  566.         WEHandle hWE);
  567. typedef pascal short (*WECharTypeProcPtr)(Ptr pText, short textOffset, ScriptCode script, WEHandle hWE);
  568.  
  569. typedef pascal OSErr (*WENewObjectProcPtr)(Point *defaultObjectSize,
  570.         WEObjectDescHandle hObjectDesc);
  571. typedef pascal OSErr (*WEDisposeObjectProcPtr)(WEObjectDescHandle hObjectDesc);
  572. typedef pascal OSErr (*WEDrawObjectProcPtr)(const Rect *destRect,
  573.         WEObjectDescHandle hObjectDesc);
  574. typedef pascal Boolean (*WEClickObjectProcPtr)(Point hitPt, EventModifiers modifiers, unsigned long clickTime,
  575.         WEObjectDescHandle hObjectDesc);
  576. typedef pascal OSErr (*WEStreamObjectProcPtr)(short destKind, FlavorType *theType, Handle putDataHere, WEObjectDescHandle hObjectDesc);
  577.  
  578.  
  579. //    UPP proc info 
  580.  
  581. enum {
  582.     uppWEClickLoopProcInfo = kPascalStackBased
  583.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  584.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  585. };
  586. enum {
  587.     uppWEScrollProcInfo = kPascalStackBased
  588.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  589. };
  590. enum {
  591.     uppWETSMPreUpdateProcInfo = kPascalStackBased
  592.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  593. };
  594. enum {
  595.     uppWETSMPostUpdateProcInfo = kPascalStackBased
  596.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  597.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*fixLength*/)))
  598.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(long /*inputAreaStart*/)))
  599.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(long /*inputAreaEnd*/)))
  600.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(long /*pinRangeStart*/)))
  601.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(long /*pinRangeEnd*/)))
  602. };
  603. enum {
  604.     uppWETranslateDragProcInfo = kPascalStackBased
  605.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  606.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(DragReference /*theDrag*/)))
  607.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(ItemReference /*theItem*/)))
  608.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(FlavorType /*requestedType*/)))
  609.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  610. };
  611. enum {
  612.     uppWEDrawTextProcInfo = kPascalStackBased
  613.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  614.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  615.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  616.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  617.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  618. };
  619. enum {
  620.     uppWEPixelToCharProcInfo = kPascalStackBased
  621.         | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  622.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  623.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  624.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  625.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(Fixed * /*pixelWidth*/)))
  626.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(char * /*edge*/)))
  627.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  628.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(Fixed /*hPos*/)))
  629.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  630. };
  631. enum {
  632.     uppWECharToPixelProcInfo = kPascalStackBased
  633.         | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  634.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  635.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  636.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(Fixed /*slop*/)))
  637.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(long /*offset*/)))
  638.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(short /*direction*/)))
  639.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(JustStyleCode /*styleRunPosition*/)))
  640.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(long /*hPos*/)))
  641.         | STACK_ROUTINE_PARAMETER(8,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  642. };
  643. enum {
  644.     uppWELineBreakProcInfo = kPascalStackBased
  645.         | RESULT_SIZE(SIZE_CODE(sizeof(StyledLineBreakCode )))
  646.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  647.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(long /*textLength*/)))
  648.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(long /*textStart*/)))
  649.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(long /*textEnd*/)))
  650.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(Fixed * /*textWidth*/)))
  651.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(long * /*textOffset*/)))
  652.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  653. };
  654. enum {
  655.     uppWEWordBreakProcInfo = kPascalStackBased
  656.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  657.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*textLength*/)))
  658.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(short /*offset*/)))
  659.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(char /*edge*/)))
  660.         | STACK_ROUTINE_PARAMETER(5,SIZE_CODE(sizeof(OffsetTable * /*breakOffsets*/)))
  661.         | STACK_ROUTINE_PARAMETER(6,SIZE_CODE(sizeof(ScriptCode * /*script*/)))
  662.         | STACK_ROUTINE_PARAMETER(7,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  663. };
  664. enum {
  665.     uppWECharByteProcInfo = kPascalStackBased
  666.         | RESULT_SIZE(SIZE_CODE(sizeof(short )))
  667.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  668.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*textOffset*/)))
  669.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode * /*script*/)))
  670.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  671. };
  672. enum {
  673.     uppWECharTypeProcInfo = kPascalStackBased
  674.         | RESULT_SIZE(SIZE_CODE(sizeof(short )))
  675.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Ptr /*pText*/)))
  676.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*textOffset*/)))
  677.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(ScriptCode * /*script*/)))
  678.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEHandle /*hWE*/)))
  679. };
  680.  
  681.  
  682. enum {
  683.     uppWENewObjectProcInfo = kPascalStackBased
  684.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  685.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point * /*defaultObjectSize*/)))
  686.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  687. };
  688. enum {
  689.     uppWEDisposeObjectProcInfo = kPascalStackBased
  690.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  691.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  692. };
  693. enum {
  694.     uppWEDrawObjectProcInfo = kPascalStackBased
  695.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  696.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(const Rect * /*destRect*/)))
  697.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  698. };
  699. enum {
  700.     uppWEClickObjectProcInfo = kPascalStackBased
  701.         | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  702.         | STACK_ROUTINE_PARAMETER(1,SIZE_CODE(sizeof(Point /*hitPt*/)))
  703.         | STACK_ROUTINE_PARAMETER(2,SIZE_CODE(sizeof(short /*modifiers*/)))
  704.         | STACK_ROUTINE_PARAMETER(3,SIZE_CODE(sizeof(unsigned long /*clickTime*/)))
  705.         | STACK_ROUTINE_PARAMETER(4,SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  706. };
  707. enum {
  708.     uppWEStreamObjectProcInfo = kPascalStackBased
  709.         | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  710.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short /*destKind*/)))
  711.         | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FlavorType * /*theType*/)))
  712.         | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle /*putDataHere*/)))
  713.         | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WEObjectDescHandle /*hObjectDesc*/)))
  714. };
  715.  
  716.  
  717. /*    UPPs, New≈Proc macros & Call≈Proc macros */
  718.  
  719. /*
  720.     NOTE:
  721.     For compatibility with the Pascal version, Call≈Proc macros take the form:
  722.  
  723.         CallFooProc(..., userRoutine)
  724.  
  725.     instead of:
  726.  
  727.         CallFooProc(userRoutine, ...)
  728.  
  729. */
  730.  
  731. #if WASTE_USE_UPPS
  732.  
  733. typedef UniversalProcPtr WEClickLoopUPP;
  734. typedef UniversalProcPtr WEScrollUPP;
  735. typedef UniversalProcPtr WETSMPreUpdateUPP;
  736. typedef UniversalProcPtr WETSMPostUpdateUPP;
  737. typedef UniversalProcPtr WETranslateDragUPP;
  738. typedef UniversalProcPtr WEDrawTextUPP;
  739. typedef UniversalProcPtr WEPixelToCharUPP;
  740. typedef UniversalProcPtr WECharToPixelUPP;
  741. typedef UniversalProcPtr WELineBreakUPP;
  742. typedef UniversalProcPtr WEWordBreakUPP;
  743. typedef UniversalProcPtr WECharByteUPP;
  744. typedef UniversalProcPtr WECharTypeUPP;
  745. typedef UniversalProcPtr WENewObjectUPP;
  746. typedef UniversalProcPtr WEDisposeObjectUPP;
  747. typedef UniversalProcPtr WEDrawObjectUPP;
  748. typedef UniversalProcPtr WEClickObjectUPP;
  749. typedef UniversalProcPtr WEStreamObjectUPP;
  750.  
  751. #define NewWEClickLoopProc(userRoutine) \
  752.     (WEClickLoopUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickLoopProcInfo, GetCurrentArchitecture())
  753. #define NewWEScrollProc(userRoutine) \
  754.     (WEScrollUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEScrollProcInfo, GetCurrentArchitecture())
  755. #define NewWETSMPreUpdateProc(userRoutine) \
  756.     (WETSMPreUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPreUpdateProcInfo, GetCurrentArchitecture())
  757. #define NewWETSMPostUpdateProc(userRoutine) \
  758.     (WETSMPostUpdateUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETSMPostUpdateProcInfo, GetCurrentArchitecture())
  759. #define NewWETranslateDragProc(userRoutine) \
  760.     (WETranslateDragUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWETranslateDragProcInfo, GetCurrentArchitecture())
  761. #define NewWEDrawTextProc(userRoutine) \
  762.     (WEDrawTextUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawTextProcInfo, GetCurrentArchitecture())
  763. #define NewWEPixelToCharProc(userRoutine) \
  764.     (WEPixelToCharUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEPixelToCharProcInfo, GetCurrentArchitecture())
  765. #define NewWECharToPixelProc(userRoutine) \
  766.     (WECharToPixelUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharToPixelProcInfo, GetCurrentArchitecture())
  767. #define NewWELineBreakProc(userRoutine) \
  768.     (WELineBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWELineBreakProcInfo, GetCurrentArchitecture())
  769. #define NewWEWordBreakProc(userRoutine) \
  770.     (WEWordBreakUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEWordBreakProcInfo, GetCurrentArchitecture())
  771. #define NewWECharByteProc(userRoutine) \
  772.     (WECharByteUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharByteProcInfo, GetCurrentArchitecture())
  773. #define NewWECharTypeProc(userRoutine) \
  774.     (WECharTypeUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWECharTypeProcInfo, GetCurrentArchitecture())
  775. #define NewWENewObjectProc(userRoutine) \
  776.     (WENewObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWENewObjectProcInfo, GetCurrentArchitecture())
  777. #define NewWEDisposeObjectProc(userRoutine) \
  778.     (WEDisposeObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDisposeObjectProcInfo, GetCurrentArchitecture())
  779. #define NewWEDrawObjectProc(userRoutine) \
  780.     (WEDrawObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEDrawObjectProcInfo, GetCurrentArchitecture())
  781. #define NewWEClickObjectProc(userRoutine) \
  782.     (WEClickObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEClickObjectProcInfo, GetCurrentArchitecture())
  783. #define NewWEStreamObjectProc(userRoutine) \
  784.     (WEStreamObjectUPP) NewRoutineDescriptor((ProcPtr) (userRoutine), uppWEStreamObjectProcInfo, GetCurrentArchitecture())
  785.  
  786. #define CallWEClickLoopProc(hWE, userRoutine) \
  787.     CallUniversalProc((userRoutine), uppWEClickLoopProcInfo, (hWE))
  788. #define CallWEScrollProc(hWE, userRoutine) \
  789.     CallUniversalProc((userRoutine), uppWEScrollProcInfo, (hWE))
  790. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  791.     CallUniversalProc((userRoutine), uppWETSMPreUpdateProcInfo, (hWE))
  792. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  793.     CallUniversalProc((userRoutine), uppWETSMPostUpdateProcInfo, (hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  794. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, userRoutine) \
  795.     CallUniversalProc((userRoutine), uppWETranslateDragProcInfo, (theDrag), (theItem), (requestedType), (putDataHere))
  796. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  797.     CallUniversalProc((userRoutine), uppWEDrawTextProcInfo, (pText), (textLength), (slop), (styleRunPosition), (hWE))
  798. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  799.     CallUniversalProc((userRoutine), uppWEPixelToCharProcInfo, (pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  800. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  801.     CallUniversalProc((userRoutine), uppWECharToPixelProcInfo, (pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  802. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  803.     CallUniversalProc((userRoutine), uppWELineBreakProcInfo, (pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  804. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  805.     CallUniversalProc((userRoutine), uppWEWordBreakProcInfo, (pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  806. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  807.     CallUniversalProc((userRoutine), uppWECharByteProcInfo, (pText), (textOffset), (script), (hWE))
  808. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  809.     CallUniversalProc((userRoutine), uppWECharTypeProcInfo, (pText), (textOffset), (script), (hWE))
  810. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) \
  811.     CallUniversalProc((userRoutine), uppWENewObjectProcInfo, (defaultObjectSize), (hObjectDesc))
  812. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) \
  813.     CallUniversalProc((userRoutine), uppWEDisposeObjectProcInfo, (hObjectDesc))
  814. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) \
  815.     CallUniversalProc((userRoutine), uppWEDrawObjectProcInfo, (destRect), (hObjectDesc))
  816. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) \
  817.     CallUniversalProc((userRoutine), uppWEClickObjectProcInfo, (hitPt), (modifiers), (clickTime), (hObjectDesc))
  818. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) \
  819.     CallUniversalProc((userRoutine), uppWEStreamObjectProcInfo, (destKind), (theType), (putDataHere), (hObjectDesc))
  820.  
  821. #else
  822.  
  823. typedef WEClickLoopProcPtr WEClickLoopUPP;
  824. typedef WEScrollProcPtr WEScrollUPP;
  825. typedef WETSMPreUpdateProcPtr WETSMPreUpdateUPP;
  826. typedef WETSMPostUpdateProcPtr WETSMPostUpdateUPP;
  827. typedef WETranslateDragProcPtr WETranslateDragUPP;
  828. typedef WEDrawTextProcPtr WEDrawTextUPP;
  829. typedef WEPixelToCharProcPtr WEPixelToCharUPP;
  830. typedef WECharToPixelProcPtr WECharToPixelUPP;
  831. typedef WELineBreakProcPtr WELineBreakUPP;
  832. typedef WEWordBreakProcPtr WEWordBreakUPP;
  833. typedef WECharByteProcPtr WECharByteUPP;
  834. typedef WECharTypeProcPtr WECharTypeUPP;
  835. typedef WENewObjectProcPtr WENewObjectUPP;
  836. typedef WEDisposeObjectProcPtr WEDisposeObjectUPP;
  837. typedef WEDrawObjectProcPtr WEDrawObjectUPP;
  838. typedef WEClickObjectProcPtr WEClickObjectUPP;
  839. typedef WEStreamObjectProcPtr WEStreamObjectUPP;
  840.  
  841. #define NewWEClickLoopProc(userRoutine) ((WEClickLoopUPP) (userRoutine))
  842. #define NewWEScrollProc(userRoutine) ((WEScrollUPP) (userRoutine))
  843. #define NewWETSMPreUpdateProc(userRoutine) ((WETSMPreUpdateUPP) (userRoutine))
  844. #define NewWETSMPostUpdateProc(userRoutine) ((WETSMPostUpdateUPP) (userRoutine))
  845. #define NewWETranslateDragProc(userRoutine) ((WETranslateDragUPP) (userRoutine))
  846. #define NewWEDrawTextProc(userRoutine) ((WEDrawTextUPP) (userRoutine))
  847. #define NewWEPixelToCharProc(userRoutine) ((WEPixelToCharUPP) (userRoutine))
  848. #define NewWECharToPixelProc(userRoutine) ((WECharToPixelUPP) (userRoutine))
  849. #define NewWELineBreakProc(userRoutine) ((WELineBreakUPP) (userRoutine))
  850. #define NewWEWordBreakProc(userRoutine) ((WEWordBreakUPP) (userRoutine))
  851. #define NewWECharByteProc(userRoutine) ((WECharByteUPP) (userRoutine))
  852. #define NewWECharTypeProc(userRoutine) ((WECharTypeUPP) (userRoutine))
  853. #define NewWENewObjectProc(userRoutine) ((WENewObjectUPP) (userRoutine))
  854. #define NewWEDisposeObjectProc(userRoutine) ((WEDisposeObjectUPP) (userRoutine))
  855. #define NewWEDrawObjectProc(userRoutine) ((WEDrawObjectUPP) (userRoutine))
  856. #define NewWEClickObjectProc(userRoutine) ((WEClickObjectUPP) (userRoutine))
  857. #define NewWEStreamObjectProc(userRoutine) ((WEStreamObjectUPP) (userRoutine))
  858.  
  859. #define CallWEClickLoopProc(hWE, userRoutine) \
  860.     (*(userRoutine))((hWE))
  861. #define CallWEScrollProc(hWE, userRoutine) \
  862.     (*(userRoutine))((hWE))
  863. #define CallWETSMPreUpdateProc(hWE, userRoutine) \
  864.     (*(userRoutine))((hWE))
  865. #define CallWETSMPostUpdateProc(hWE, fixLength, inputAreaStart, inputAreaEnd, pinRangeStart, pinRangeEnd, userRoutine) \
  866.     (*(userRoutine))((hWE), (fixLength), (inputAreaStart), (inputAreaEnd), (pinRangeStart), (pinRangeEnd))
  867. #define CallWETranslateDragProc(theDrag, theItem, requestedType, putDataHere, userRoutine) \
  868.     (*(userRoutine))((theDrag), (theItem), (requestedType), (putDataHere))
  869. #define CallWEDrawTextProc(pText, textLength, slop, styleRunPosition, hWE, userRoutine) \
  870.     (*(userRoutine))((pText), (textLength), (slop), (styleRunPosition), (hWE))
  871. #define CallWEPixelToCharProc(pText, textLength, slop, pixelWidth, edge, styleRunPosition, hPos, hWE, userRoutine) \
  872.     (*(userRoutine))((pText), (textLength), (slop), (pixelWidth), (edge), (styleRunPosition), (hPos), (hWE))
  873. #define CallWECharToPixelProc(pText, textLength, slop, offset, direction, styleRunPosition, hPos, hWE, userRoutine) \
  874.     (*(userRoutine))((pText), (textLength), (slop), (offset), (direction), (styleRunPosition), (hPos), (hWE))
  875. #define CallWELineBreakProc(pText, textLength, textStart, textEnd, textWidth, textOffset, hWE, userRoutine) \
  876.     (*(userRoutine))((pText), (textLength), (textStart), (textEnd), (textWidth), (textOffset), (hWE))
  877. #define CallWEWordBreakProc(pText, textLength, offset, edge, breakOffsets, script, hWE, userRoutine) \
  878.     (*(userRoutine))((pText), (textLength), (offset), (edge), (breakOffsets), (script), (hWE))
  879. #define CallWECharByteProc(pText, textOffset, script, hWE, userRoutine) \
  880.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  881. #define CallWECharTypeProc(pText, textOffset, script, hWE, userRoutine) \
  882.     (*(userRoutine))((pText), (textOffset), (script), (hWE))
  883. #define CallWENewObjectProc(defaultObjectSize, hObjectDesc, userRoutine) \
  884.     (*(userRoutine))((defaultObjectSize), (hObjectDesc))
  885. #define CallWEDisposeObjectProc(hObjectDesc, userRoutine) \
  886.     (*(userRoutine))((hObjectDesc))
  887. #define CallWEDrawObjectProc(destRect, hObjectDesc, userRoutine) \
  888.     (*(userRoutine))((destRect), (hObjectDesc))
  889. #define CallWEClickObjectProc(hitPt, modifiers, clickTime, hObjectDesc, userRoutine) \
  890.     (*(userRoutine))((hitPt), (modifiers), (clickTime), (hObjectDesc))
  891. #define CallWEStreamObjectProc(destKind, theType, putDataHere, hObjectDesc, userRoutine) \
  892.     (*(userRoutine))((destKind), (theType), (putDataHere), (hObjectDesc))
  893.  
  894. #endif
  895.  
  896. typedef Boolean (*SegmentLoopProcPtr)
  897.                 (LinePtr pLine,
  898.                  const WERunAttributes *pAttrs,
  899.                  Ptr pSegment,
  900.                  long segmentStart,
  901.                  long segmentLength,
  902.                  JustStyleCode styleRunPosition,
  903.                  void *callbackData);
  904.  
  905. typedef FourCharCode WESelector;
  906.  
  907. typedef struct WEFieldDescriptor {
  908.     short fOffset;
  909.     short fLength;
  910. } WEFieldDescriptor;
  911.  
  912. typedef struct WELookupTable {
  913.     WESelector selector;
  914.     WEFieldDescriptor desc;
  915. } WELookupTable;
  916.  
  917. typedef struct WEOHTableElement {
  918.     FlavorType objectType;
  919.     WENewObjectUPP newHandler;
  920.     WEDisposeObjectUPP freeHandler;
  921.     WEDrawObjectUPP drawHandler;
  922.     WEClickObjectUPP clickHandler;
  923.     WEStreamObjectUPP streamHandler;
  924. } WEOHTableElement, *WEOHTablePtr, **WEOHTableHandle;
  925.  
  926. typedef struct WEObjectDesc {
  927.     FlavorType objectType;                // 4-letter tag identifying object type
  928.     Handle objectDataHandle;            // handle to object data
  929.     Point objectSize;                    // object height and width, in pixels
  930.     WEOHTableHandle objectTable;        // handle to object handler table
  931.     long objectIndex;                    // index into object handler table
  932.     WEHandle objectOwner;                // handle to owner WE instance
  933.     long objectRefCon;                    // free for use by object handlers
  934. } WEObjectDesc;
  935.  
  936. typedef struct    WERec {
  937.     GrafPtr port;                            // graphics port text is drawn into 
  938.     Handle hText;                            // handle to the text 
  939.     LineArrayHandle hLines;                    // handle to the line array 
  940.     StyleTableHandle hStyles;                // handle to the style table 
  941.     RunArrayHandle hRuns;                    // handle to the style run array 
  942.     long textLength;                        // length of text 
  943.     long nLines;                            // number of lines 
  944.     long nStyles;                            // number of unique styles in the style table 
  945.     long nRuns;                                // number of style runs 
  946.     LongRect viewRect;                        // view rectangle, all drawing is clipped to this 
  947.     LongRect destRect;                        // destination rectangle 
  948.     long selStart;                            // start of selection range 
  949.     long selEnd;                            // end of selection range 
  950.     unsigned long flags;                    // 32 bits of miscellaneous flags (private)
  951.     unsigned long features;                    // 32 bit of feature flags (public)
  952.     unsigned long caretTime;                // time of most recent caret drawing, in ticks 
  953.     unsigned long clickTime;                // time of most recent click, in ticks 
  954.     long clickLoc;                            // byte offset of most recent click 
  955.     long anchorStart;                        // start offset of anchor word/line 
  956.     long anchorEnd;                            // end offset of anchor word/line 
  957.     WEClickLoopUPP clickLoop;                // click loop callback 
  958.     char unused1;                            // unused 
  959.     char clickEdge;                            // edge of character hit by most recent click 
  960.     char unused2;                            // unused 
  961.     char firstByte;                            // first byte of a double-byte character 
  962.     GrafPtr offscreenPort;                    // offscreen graphics world 
  963.     RgnHandle viewRgn;                        // handle to the view region 
  964.     WEScrollUPP scrollProc;                    // scroll callback 
  965.     unsigned short clickCount;                // multiple click count     
  966.     char alignment;                            // alignment style 
  967.     void *refCon;                            // reference value for client use 
  968.     TSMDocumentID tsmReference;                // reference value for the text services manager 
  969.     long tsmAreaStart;                        // start of active input area (for TSM) 
  970.     long tsmAreaEnd;                        // end of active input area 
  971.     WETSMPreUpdateUPP tsmPreUpdate;            // TSM pre-update callback 
  972.     WETSMPostUpdateUPP tsmPostUpdate;        // TSM post-update callback 
  973.     DragReference currentDrag;                // reference of drag being tracked by _WEDrag 
  974.     long dragCaretOffset;                    // offset to caret displayed during a drag 
  975.     WETranslateDragUPP translateDragHook;    // drag translation hook 
  976.     WEActionHandle hActionStack;            // action stack for undo 
  977.     unsigned long modCount;                    // modification count 
  978.     WEDrawTextUPP drawTextHook;                // hook for drawing text
  979.     WEPixelToCharUPP pixelToCharHook;        // hook for hit-testing
  980.     WECharToPixelUPP charToPixelHook;        // hook for locating glyph position
  981.     WELineBreakUPP lineBreakHook;            // hook for finding line breaks
  982.     WEWordBreakUPP wordBreakHook;            // hook for finding word breaks
  983.     WECharByteUPP charByteHook;                // hook for finding character byte type
  984.     WECharTypeUPP charTypeHook;                // hook for finding character type
  985.     WERunAttributes nullStyle;                // style for null selection
  986. #if WASTE_OBJECTS
  987.     WEOHTableHandle hObjectHandlerTable;    // handle to object handler table for this instance
  988. #endif
  989. } WERec;
  990.  
  991. struct SLDrawData {
  992.     WEHandle hWE;
  993.     Rect bounds;
  994.     Rect lineRect;                // rect enclosing current line mf
  995.     Rect drawRect;                // visible portion of line rect mf
  996.     PixMapHandle offscreenPixels; // mf
  997.     GrafPtr screenPort;            // DWC 5/18/95
  998.     GDHandle screenDevice;
  999.     Boolean usingColor;            // true if drawing in color 
  1000.     Boolean usingOffscreen;        // true if an offscreen graphics world has been set up 
  1001.     Boolean drawingOffscreen;    // true if actually drawing to an offscreen buffer 
  1002.     Boolean doErase;
  1003. };
  1004.  
  1005. struct SLCalcSlopData {
  1006.     WEPtr pWE;
  1007.     short lineWidth;
  1008.     short totalSlop;
  1009.     Fixed totalProportion;
  1010. };
  1011.  
  1012. struct SLPixelToCharData {
  1013.     WEHandle hWE;
  1014.     Fixed hPos;
  1015.     Fixed pixelWidth;
  1016.     long offset;
  1017.     char *edge;
  1018. };
  1019.  
  1020. struct SLCharToPixelData {
  1021.     WEHandle hWE;
  1022.     long offset;
  1023.     LongPt *thePoint;
  1024. };
  1025.  
  1026.  
  1027. #if defined(powerc) || defined (__powerc)
  1028. #pragma options align=reset
  1029. #endif
  1030.  
  1031.  
  1032. // Routines in WEUtilities.c
  1033. pascal void _WEForgetHandle(Handle *h);
  1034. pascal Boolean _WESetHandleLock(Handle h, Boolean lock);
  1035. pascal void _WEBlockClr(void *block, long blockSize);
  1036. pascal Boolean _WEBlockCmp(const void *block1, const void *block2, long blockSize);
  1037. pascal void _WEReorder(long *a, long *b);
  1038. pascal OSErr _WEAllocate(long blockSize, short allocFlags, Handle *h);
  1039.  
  1040. // in WEArrays.c
  1041. pascal OSErr _WEInsertBlock(Handle h, const void *blockPtr, long blockSize, long offset);
  1042. pascal void _WERemoveBlock(Handle h, long blockSize, long offset);
  1043.  
  1044. // in WEBirthDeath.c
  1045. pascal OSErr _WERegisterWithTSM(WEHandle hWE);
  1046. pascal void _WESetStandardHooks(WEHandle hWE);
  1047. pascal OSErr WENew(const LongRect *destRect, const LongRect *viewRect, short features, WEHandle *hWE);
  1048. pascal void WEDispose(WEHandle hWE);
  1049. pascal void _WEStdDrawText(Ptr pText, long textLength, Fixed slop, 
  1050.                 JustStyleCode styleRunPosition, WEHandle hWE);
  1051. pascal long _WEStdPixelToChar(Ptr pText, long textLength, Fixed slop,
  1052.                 Fixed *width, char *edge, JustStyleCode styleRunPosition,
  1053.                 Fixed hPos, WEHandle hWE);
  1054. pascal short _WEStdCharToPixel(Ptr pText, long textLength, Fixed slop,
  1055.                 long offset, short direction, JustStyleCode styleRunPosition,
  1056.                 long hPos, WEHandle hWE);
  1057. pascal StyledLineBreakCode _WEStdLineBreak(Ptr pText, long textLength,
  1058.                 long textStart, long textEnd, Fixed *textWidth,
  1059.                 long *textOffset, WEHandle hWE);
  1060. pascal void _WEStdWordBreak(Ptr pText, short textLength, short offset,
  1061.                 char edge, OffsetTable breakOffsets, ScriptCode script,
  1062.                 WEHandle hWE);
  1063. pascal short _WEStdCharByte(Ptr pText, short textLength, ScriptCode script,
  1064.                 WEHandle hWE);
  1065. pascal short _WEStdCharType(Ptr pText, short textLength, ScriptCode script,
  1066.                 WEHandle hWE);
  1067. pascal short _WEScriptToFont(ScriptCode script);
  1068. pascal void _WEOldWordBreak(Ptr pText, short textLength, short offset,
  1069.                 char edge, OffsetTable breakOffsets, ScriptCode script,
  1070.                 WEHandle hWE);
  1071. pascal short _WEOldCharByte(Ptr pText, short textLength, ScriptCode script,
  1072.                 WEHandle hWE);
  1073. pascal short _WEOldCharType(Ptr pText, short textLength, ScriptCode script,
  1074.                 WEHandle hWE);
  1075.  
  1076. // in WEDebug.c
  1077. pascal void _WESanityCheck(WEHandle hWE);
  1078.  
  1079. // in WEInlineInput.c
  1080. pascal OSErr _WEHiliteRangeArray(TextRangeArrayHandle hTray, WEHandle hWE);
  1081. pascal OSErr _WEHandleUpdateActiveInputArea(AppleEvent *ae, AppleEvent *reply,
  1082.         long handlerRefCon);
  1083. pascal OSErr _WEHandlePositionToOffset(AppleEvent *ae, AppleEvent *reply,
  1084.         long handlerRefCon);
  1085. pascal OSErr _WEHandleOffsetToPosition(AppleEvent *ae, AppleEvent *reply, long handlerRefCon);
  1086. pascal OSErr WEInstallTSMHandlers(void);
  1087. pascal OSErr WERemoveTSMHandlers(void);
  1088.  
  1089. // in WELongCoords.c
  1090. pascal long _WEPinInRange(long value, long rangeStart, long rangeEnd);
  1091. pascal void WELongPointToPoint(const LongPt *lp, Point *p);
  1092. pascal void WEPointToLongPoint(Point p, LongPt *lp);
  1093. pascal void WESetLongRect(LongRect *lr, long left, long top, long right, long bottom);
  1094. pascal void WELongRectToRect(const LongRect *lr, Rect *r);
  1095. pascal void WERectToLongRect(const Rect *r, LongRect *lr);
  1096. pascal void WEOffsetLongRect(LongRect *lr, long hOffset, long vOffset);
  1097. pascal Boolean WELongPointInLongRect(const LongPt *lp, const LongRect *lr);
  1098.  
  1099. // in WEDrawing.c
  1100. pascal long WEOffsetToLine (long offset, WEHandle hWE);
  1101. pascal long _WEPixelToLine(long vOffset, WEHandle hWE);
  1102. pascal long _WEOffsetToRun (long offset, WEHandle hWE);
  1103. pascal void _WEGetIndStyle(long runIndex, WERunInfo *info, WEHandle hWE);
  1104. pascal void WEGetRunInfo(long offset, WERunInfo *info, WEHandle hWE);
  1105. pascal OSErr WEGetSelectedObject(WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1106. pascal long WEFindNextObject(long offset, WEObjectDescHandle *hObjectDesc, WEHandle hWE);
  1107. pascal void _WEContinuousStyleRange(long rangeStart, long rangeEnd, short *mode,
  1108.         WETextStyle *ts, WEHandle hWE);
  1109. pascal void _WESynchNullStyle(WEHandle hWE);
  1110. pascal Boolean WEContinuousStyle (short *mode, TextStyle *ts, WEHandle hWE);
  1111. pascal void _WESegmentLoop(long firstLine, long lastLine, SegmentLoopProcPtr callback, void *callbackData,
  1112.         WEHandle hWE);
  1113. pascal void _WEDrawTSMHilite(Rect *segmentRect, short tsFlags);
  1114. pascal void _WEDrawLines (long firstLine, long lastLine, Boolean doErase, WEHandle hWE);
  1115. pascal short _WECalcPenIndent(short slop, short alignment);
  1116. pascal void _WESaveQDEnvironment(GrafPtr port, Boolean saveColor, QDEnvironment *theEnvironment);
  1117. pascal void _WERestoreQDEnvironment(const QDEnvironment *theEnvironment);
  1118. pascal void _WEFillFontInfo (GrafPtr port, WERunAttributes *targetStyle);
  1119. pascal void _WECopyStyle (const WETextStyle *sourceStyle, WETextStyle *targetStyle, short offStyles,
  1120.         short mode);
  1121. pascal Boolean _WEOffsetInRange(long offset, char edge, long rangeStart, long rangeEnd);
  1122.  
  1123. // WELineLayout.c
  1124. pascal void WEStopInlineSession(WEHandle hWE);
  1125. pascal void _WERemoveLine(long lineIndex, WEPtr pWE);
  1126. pascal OSErr _WEInsertLine(long lineIndex, const LineRec *theLine, WEPtr pWE);
  1127. pascal void _WEBumpOrigin(long lineIndex, long deltaOrigin, WEPtr pWE);
  1128. pascal long _WEFindLineBreak(long lineStart, WEHandle hWE);
  1129. pascal void _WECalcHeights(long rangeStart, long rangeEnd, short *lineAscent, short *lineDescent,
  1130.         WEHandle hWE);
  1131. pascal OSErr _WERecalBreaks(long *startLine, long *endLine, WEHandle hWE);
  1132. pascal void _WERecalSlops(long firstLine, long lastLine, WEHandle hWE);
  1133. pascal OSErr WECalText(WEHandle hWE);
  1134. pascal OSErr WEUseText(Handle text, WEHandle hWE);
  1135. pascal char WEGetAlignment(WEHandle hWE);
  1136. pascal void WEGetSelection(long *selStart, long *selEnd, WEHandle hWE);
  1137. pascal void WESetDestRect(const LongRect *destRect, WEHandle hWE);
  1138. pascal void WEGetDestRect(LongRect *destRect, WEHandle hWE);
  1139. pascal void WESetViewRect(const LongRect *viewRect, WEHandle hWE);
  1140. pascal void WEGetViewRect(LongRect *viewRect, WEHandle hWE);
  1141. pascal long WEGetTextLength(WEHandle hWE);
  1142. pascal long WECountLines(WEHandle hWE);
  1143. pascal long WEGetHeight(long startLine, long endLine, WEHandle hWE);
  1144. pascal Handle WEGetText(WEHandle hWE);
  1145. pascal short WEGetChar(long offset, WEHandle hWE);
  1146. pascal short WEFeatureFlag(short feature, short action, WEHandle hWE);
  1147.  
  1148. // WESelecting.c
  1149. pascal void _WEClearHiliteBit(void);
  1150. pascal long WEGetOffset(const LongPt *thePoint, char *edge, WEHandle hWE);
  1151. pascal void WEGetPoint(long offset, LongPt *thePoint, short *lineHeight, WEHandle hWE);
  1152. pascal void WEFindLine(long offset, char edge, long *lineStart, long *lineEnd, WEHandle hWE);
  1153. pascal long _WEGetLineStart(long lineNo, WEHandle hWE);
  1154. pascal short _WEGetContext(long offset, long *contextStart, long *contextEnd,
  1155.                         WEHandle hWE);
  1156. pascal short _WEGetRestrictedContext(long offset, long *contextStart, long *contextEnd,
  1157.                         WEHandle hWE);
  1158. pascal void WEFindWord(long offset, char edge, long *wordStart, long *wordEnd, WEHandle hWE);
  1159. pascal short WECharByte(long offset, WEHandle hWE);
  1160. pascal short WECharType(long offset, WEHandle hWE);
  1161. pascal void _WEDrawCaret(long offset, WEHandle hWE);
  1162. pascal void _WEBlinkCaret(WEHandle hWE);
  1163. pascal RgnHandle WEGetHiliteRgn(long rangeStart, long rangeEnd, WEHandle hWE);
  1164. pascal void _WEHiliteRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1165. pascal void WESetSelection(long selStart, long selEnd, WEHandle hWE);
  1166. pascal void WESetAlignment(char alignment, WEHandle hWE);
  1167. pascal long _WEArrowOffset(short action, long offset, WEHandle hWE);
  1168. pascal void _WEDoArrowKey (short arrow, EventModifiers modifiers, WEHandle hWE);
  1169. pascal Boolean WEAdjustCursor(Point mouseLoc, RgnHandle mouseRgn, WEHandle hWE);
  1170. pascal void WEIdle(unsigned long *maxSleep, WEHandle hWE);
  1171. pascal void WEUpdate(RgnHandle updateRgn, WEHandle hWE);
  1172. pascal void WEDeactivate(WEHandle hWE);
  1173. pascal void WEActivate(WEHandle hWE);
  1174. pascal Boolean WEIsActive(WEHandle hWE);
  1175. pascal void WEScroll(long hOffset, long vOffset, WEHandle hWE);
  1176. pascal Boolean _WEScrollIntoView (long offset, WEHandle hWE);
  1177. pascal void WESelView(WEHandle hWE);
  1178.  
  1179. // WELowLevelEditing.c
  1180. pascal Boolean _WEIsWordRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1181. pascal Boolean _WEIsPunct(long offset, WEHandle hWE);
  1182. pascal void _WEIntelligentCut(long *rangeStart, long *rangeEnd, WEHandle hWE);
  1183. pascal short _WEIntelligentPaste(long rangeStart, long rangeEnd, WEHandle hWE);
  1184. pascal OSErr _WEInsertRun(long runIndex, long offset, long styleIndex, WEPtr pWE);
  1185. pascal void _WERemoveRun(long runIndex, WEPtr pWE);
  1186. pascal void _WEChangeRun(long runIndex, long newStyleIndex, Boolean keepOld, WEPtr pWE);
  1187. pascal OSErr _WENewStyle(const WETextStyle *ts, long *styleIndex, WEPtr pWE);
  1188. pascal OSErr _WERedraw(long rangeStart, long rangeEnd, WEHandle hWE);
  1189. pascal OSErr _WESetStyleRange(long rangeStart, long rangeEnd, short mode, const WETextStyle *ts, WEHandle hWE);
  1190. pascal OSErr _WEApplyStyleScrap(long rangeStart, long rangeEnd, StScrpHandle styleScrap, WEHandle hWE);
  1191. pascal OSErr _WEApplySoup(long offset, Handle hSoup, WEHandle hWE);
  1192. pascal void _WEBumpRunStart(long runIndex, long deltaRunStart, WEPtr pWE);
  1193. pascal void _WERemoveRunRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1194. pascal void _WEBumpLineStart(long lineIndex, long deltaLineStart, WEPtr pWE);
  1195. pascal void _WERemoveLineRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1196. pascal OSErr _WEDeleteRange(long rangeStart, long rangeEnd, WEHandle hWE);
  1197. pascal OSErr _WEInsertText(long offset, Ptr textPtr, long textLength, WEHandle hWE);
  1198.  
  1199. // WEHighLevelEditing.c
  1200. pascal WEActionHandle WEGetActionStack(WEHandle hWE);
  1201. pascal OSErr WEPushAction(WEActionHandle hAction);
  1202. pascal OSErr WENewAction(long rangeStart, long rangeEnd, long newTextLength,
  1203.                             WEActionKind actionKind, WEActionFlags actionFlags,
  1204.                             WEHandle hWE, WEActionHandle *hAction);
  1205. pascal void WEDisposeAction(WEActionHandle hAction);
  1206. pascal void WEForgetAction(WEActionHandle *hAction);
  1207. pascal OSErr WEDoAction(WEActionHandle hAction);
  1208. pascal OSErr WEUndo(WEHandle hWE);
  1209. pascal void WEClearUndo(WEHandle hWE);
  1210. pascal WEActionKind WEGetUndoInfo(Boolean *redoFlag, WEHandle hWE);
  1211. pascal unsigned long WEGetModCount(WEHandle hWE);
  1212. pascal void WEResetModCount(WEHandle hWE);
  1213. pascal void _WEAdjustUndoRange(long moreBytes, WEHandle hWE);
  1214. pascal OSErr _WETypeChar(char theByte, WEHandle hWE);
  1215. pascal OSErr _WEBackspace(WEHandle hWE);
  1216. pascal OSErr _WEForwardDelete(WEHandle hWE);
  1217. pascal Boolean WEIsTyping(WEHandle hWE);
  1218. pascal void WEKey(short key, EventModifiers modifiers, WEHandle hWE);
  1219. pascal OSErr WEInsert(Ptr textPtr, long textLength, StScrpHandle hStyles, Handle hSoup, WEHandle hWE);
  1220. pascal OSErr WEInsertObject(FlavorType objectType, Handle objectDataHandle, Point objectSize, WEHandle hWE);
  1221. pascal OSErr WEDelete(WEHandle hWE);
  1222. pascal OSErr WECut(WEHandle hWE);
  1223. pascal Boolean WECanPaste(WEHandle hWE);
  1224. pascal OSErr WEPaste(WEHandle hWE);
  1225. pascal OSErr _WESmartSetFont(short mode, const TextStyle *ts, WEHandle hWE);
  1226. pascal OSErr WESetStyle(short mode, const TextStyle *ts, WEHandle hWE);
  1227. pascal OSErr WEUseStyleScrap(StScrpHandle hStyles, WEHandle hWE);
  1228.  
  1229. // WEMouse.c
  1230. pascal Boolean _WEIsOptionDrag(DragReference theDrag);
  1231. pascal OSErr _WEGetFlavor(DragReference theDrag, ItemReference theItem,
  1232.                 FlavorType requestedType, Handle hFlavor,
  1233.                 WETranslateDragUPP translateDragHook);
  1234. pascal OSErr _WEExtractFlavor(DragReference theDrag, ItemReference theItem,
  1235.                         FlavorType theType, Handle *hFlavor,
  1236.                         WETranslateDragUPP translateDragHook);
  1237. pascal Boolean WECanAcceptDrag(DragReference theDrag, WEHandle hWE);
  1238. pascal void _WEUpdateDragCaret(long offset, WEHandle hWE);
  1239. pascal OSErr WETrackDrag(DragTrackingMessage theMessage,DragReference theDrag,
  1240.                                     WEHandle hWE);
  1241. pascal OSErr WEReceiveDrag(DragReference theDrag, WEHandle hWE);
  1242. pascal OSErr _WESendFlavor(FlavorType requestedType, void *dragSendRefCon,
  1243.                                     WEHandle hWE, DragReference theDrag);
  1244. pascal Boolean WEDraggedToTrash(DragReference theDrag);
  1245. pascal OSErr _WEDrag(Point mouseLoc, EventModifiers modifiers, unsigned long clickTime, WEHandle hWE);
  1246. pascal void WEClick(Point mouseLoc, EventModifiers modifiers, unsigned long clickTime, WEHandle hWE);
  1247.  
  1248. // WEObjects.c
  1249. pascal FlavorType WEGetObjectType(WEObjectDescHandle hObjectDesc);
  1250. pascal Handle WEGetObjectDataHandle(WEObjectDescHandle hObjectDesc);
  1251. pascal Point WEGetObjectSize(WEObjectDescHandle hObjectDesc);
  1252. pascal WEHandle WEGetObjectOwner(WEObjectDescHandle hObjectDesc);
  1253. pascal long WEGetObjectRefCon(WEObjectDescHandle hObjectDesc);
  1254. pascal void WESetObjectRefCon(WEObjectDescHandle hObjectDesc, long refCon);
  1255. pascal long _WELookupObjectType(FlavorType objectType, WEOHTableHandle hTable);
  1256. pascal OSErr _WEGetIndObjectType(long index, FlavorType *objectType, WEHandle hWE);
  1257. pascal OSErr _WENewObject(FlavorType objectType, Handle objectDataHandle, WEHandle hWE,
  1258.                     WEObjectDescHandle *hObjectDesc);
  1259. pascal OSErr _WEFreeObject(WEObjectDescHandle hObjectDesc);
  1260. pascal OSErr _WEDrawObject(WEObjectDescHandle hObjectDesc);
  1261. pascal Boolean _WEClickObject(Point hitPt, EventModifiers modifiers, unsigned long clickTime,
  1262.                                 WEObjectDescHandle hObjectDesc);
  1263. pascal OSErr _WEStreamObject(short destKind, FlavorType *theType, Handle *theData,
  1264.                 Boolean *canDisposeData, WEObjectDescHandle hObjectDesc);
  1265. pascal OSErr WEInstallObjectHandler(FlavorType objectType, WESelector handlerSelector, UniversalProcPtr handler,
  1266.                 WEHandle hWE);
  1267.  
  1268. // WEScraps.c
  1269. pascal OSErr _WEPrependStyle(Handle hStyleScrap, const WERunInfo *info, long offsetDelta);
  1270. pascal OSErr _WEAppendStyle(Handle hStyleScrap, const WERunInfo *info, long offset);
  1271. pascal OSErr _WEPrependObject(Handle hSoup, const WERunInfo *info, long offsetDelta);
  1272. pascal OSErr _WEAppendObject(Handle hSoup, const WERunInfo *info, long offset);
  1273. pascal OSErr WECopyRange(long rangeStart, long rangeEnd, Handle hText, Handle
  1274.                     hStyles, Handle hSoup, WEHandle hWE);
  1275. pascal OSErr WECopy(WEHandle hWE);
  1276.  
  1277.  
  1278. // WESelectors.c
  1279. pascal void _WELookupSelector(const WELookupTable *table, WESelector selector, WEFieldDescriptor *desc);
  1280. pascal OSErr _WEGetField(const WELookupTable *table, WESelector selector, long *info, void *structure);
  1281. pascal OSErr _WESetField(const WELookupTable *table, WESelector selector, long *info, void *structure);
  1282. pascal OSErr WEGetInfo(WESelector selector, void *info, WEHandle hWE);
  1283. pascal OSErr WESetInfo(WESelector selector, const void *info, WEHandle hWE);
  1284. pascal OSErr _WESetHandler(WESelector selector, long *info, void *structure);
  1285.